import request from '@/utils/request'

/**
 * 文书送达模块- 详情表接口
 */
const apl_arrive_detail_API = {
    saveTemp: '/apl_arrive_detail/saveTemp', // 暂存接口
    saveSend: '/apl_arrive_detail/saveSend', // 通过applyidl来查询对应的案件送达详情
    deletePersonById: '/apl_arrive_person/delete', // 删除对应的数据
    getReviewDetailByApplyid: '/apl_arrive_detail/getReviewDetailByApplyid', // 送达送达人，第三人详情查询
    getDocumentTree: '/apl_arrive_detail/getDocumentTree', // 通过案号匹配对应的送达树结构
    saveNewDetail: '/apl_arrive_detail/saveNewDetail', // 新增送达详情信息
    getByUserid: '/apl_arrive_detail/getByUserid', // 查询用户对应的待送达信息
    getByApplyid: '/apl_arrive_detail/getByApplyid', // 通过applyid查询最近待送达的数据
    deleteDetailById: '/apl_arrive_detail/deleteDetailById', // 通过id删除送达记录
    getReceiptById: '/apl_arrive_receipt/getReceiptById',
    deleteMaterial: '/apl_arrive_material/delete' // 删除材料id

}
/**
 * 暂存接口
 * @param {} body
 * @returns
 */
export function saveTemp (body) {
    return request({
        url: apl_arrive_detail_API.saveTemp,
        method: 'post',
        data: body
    })
}

/**
 * 一键送达接口
 * @param {*} body
 * @returns
 */
export function saveSend (body, sendUserId, sendUserName) {
    return request({
        url: apl_arrive_detail_API.saveSend,
        method: 'post',
        data: body,
        params: {
            sendUserId: sendUserId,
            sendUserName: sendUserName
        }
    })
}

/**
 * 删除对应的人员数据
 * @param {} id
 * @returns
 */
export function deletePersonById (id) {
    return request({
        url: apl_arrive_detail_API.deletePersonById,
        method: 'post',
        params: {
            id: id
        }
    })
}

/**
 * 送达送达人，第三人详情页面
 * @param {*} applyid
 * @returns
 */
export function getReviewDetailByApplyid (applyid) {
    return request({
        url: apl_arrive_detail_API.getReviewDetailByApplyid,
        method: 'post',
        params: {
            applyid: applyid
        }
    })
}

/**
 * 通过applyid匹配对应的送达树结构
 * @param {*} applyid
 * @returns
 */
export function getDocumentTree (applyid) {
    return request({
        url: apl_arrive_detail_API.getDocumentTree,
        method: 'post',
        params: {
            applyid: applyid
        }
    })
}

/**
 * 新增送达详情信息
 * @returns
 */
export function saveNewDetail (body) {
    return request({
        url: apl_arrive_detail_API.saveNewDetail,
        method: 'post',
        data: body
    })
}

/**
 * 用户对应的待送达信息
 * @param {*} userid
 * @returns
 */
export function getByUserid (userid) {
    return request({
        url: apl_arrive_detail_API.getByUserid,
        method: 'post',
        params: {
            userid: userid
        }
    })
}


/**
 * 对应applyid最近的一条待处理送达
 * @param {*} applyid
 * @returns
 */
export function getByApplyid (applyid) {
    return request({
        url: apl_arrive_detail_API.getByApplyid,
        method: 'post',
        params: {
            applyid: applyid
        }
    })
}

/**
 * 通过id删除送达记录
 * @param {*} id
 * @returns
 */
export function deleteDetailById (id) {
    return request({
        url: apl_arrive_detail_API.deleteDetailById,
        method: 'post',
        params: {
            id: id
        }
    })
}


/**
 * 通过recordId查询回执详情
 * @param {} recordId
 * @returns
 */
export function getReceiptById (recordId) {
    return request({
        url: apl_arrive_detail_API.getReceiptById,
        method: 'post',
        params: {
            recordId: recordId
        }
    })
}


/**
 * 删除材料id
 * @param {} id
 * @returns
 */
export function deleteMaterial (id) {
    return request({
        url: apl_arrive_detail_API.deleteMaterial,
        method: 'post',
        params: {
            id: id
        }
    })
}